<?php
defined('_JEXEC') or die('Restricted access');
?>
<?php
	$session =& JFactory::getSession();
	for ($i=1; $i<=$session->get('itemAmount'); $i++) {
		$arrId[] = $session->get('id'.$i);
	}
?>
<div class="main-content clear-fix" id="order-page">
    {module Pro Categories}
    <div class="content-right" id="order-right">
        <h2>Søgeresultat</h2>
        <div id="order-table">
        <?php if($this->products){?>				
            <ul class="table">
                <li class="table-caption clear-fix">
                    <div class="table-col table-col-1">Varenr</div>
                    <div class="table-col table-col-2">Varenavn</div>
                    <div class="table-col table-col-3">Producent</div>
                    <div class="table-col table-col-4">Enhed</div>
                    <div class="table-col table-col-5">Enhed/colli</div>
                    <div class="table-col table-col-6">Pris/enhed</div>
                    <div class="table-col table-col-7">Antal colli</div>
                </li>
                <?php foreach($this->products as $pro){?>
                <li class="table-row clear-fix <?php if(in_array($pro->id,$arrId)) echo 'item-added';?> <?php if(!$pro->quantity) echo 'sold-out';?>">
                    <div class="table-col table-col-1">
                        <a class="info-ico" <?php if($pro->basic_info) echo 'data-reveal-id="prdDetail-'.$pro->id.'"';?> title="Tryk her!">Info</a>
                        <p><?php echo $pro->number?></p>
                        <div class="clear"></div>
                    </div>
                    <div class="table-col table-col-2">
                        <p><?php echo $pro->name?></p>
                        <?php if($pro->expiry){?><a class="info-clock" title="<?php echo $pro->expiry?>">clock</a><?php }?>
                        <?php if($pro->promotion){?><a class="sale-off" title="Tibud">Sale off</a><?php }?>
                        <div class="clear"></div>
                    </div>
                    <div class="table-col table-col-3">
                        <p><?php echo $pro->com_name?></p>
                        <div class="col-3-setting">
                        	<?php $arrType = explode(',', $pro->type);
								for($i=1; $i<=7; $i++){
									if(in_array($i, $arrType)){
										if($i == 1) $title = 'title="Fuldkornsmærket"';
										if($i == 2) $title = 'title="Økologisk"';
										if($i == 3) $title = 'title="Fairtrade"';
										if($i == 4) $title = 'title="MSC"';
										if($i == 5) $title = 'title="Frost"';
										if($i == 6) $title = 'title="Temperature"';
										if($i == 7) $title = 'title="EU Organic"';
							?>
                            		<a class="setting-<?php echo $i?>" <?php echo $title;?>>Setting <?php echo $i?></a>
                            <?php 
									}
								}?>						
                            <div class="clear"></div>
                        </div>									
                        <div class="clear"></div>
                    </div>
                    <div class="table-col table-col-4"><?php echo $pro->unit?></div>
                    <div class="table-col table-col-5"><?php echo $pro->parcel?></div>
                    <div class="table-col table-col-6"><?php echo $pro->price?> kr</div>
                    <div class="table-col table-col-7">
                        <input class="table-quantity" type="text" name="quantity<?php echo $pro->id;?>" id="quantity<?php echo $pro->id;?>" value="1"/>
                        <input type="hidden" name="id<?php echo $pro->id;?>" id="id<?php echo $pro->id;?>" value="<?php echo $pro->id;?>"/>
                        <a class="table-order" href="javascript:void(0);">Order</a>
                        <div id="prdDetail-<?php echo $pro->id;?>" class="reveal-modal prdDetail-div">
                            <iframe src="index.php?option=com_ecommerce&view=detail&id=<?php echo $pro->id;?>&tmpl=component" style="overflow:hidden; width:700px; height:645px;"></iframe>
                             <a id="close-reveal-modal" class="close-reveal-modal"></a>
                        </div>									
                        <div class="clear"></div>
                    </div>
                </li>
                <?php }?>
            </ul>
            <?php } else {
				echo "Uden resultater";
			}?>
        </div>
    </div>
</div>